package com.tnovoselec.android.common.async.notif;

import java.util.concurrent.Future;

import com.tnovoselec.android.common.async.listener.ResultListener;
import com.tnovoselec.android.common.async.runner.Runner;


public interface Notifier {

	/**
	 * Notifies the specified listener that a result's calculation has completed.
	 * 
	 * @param listener The listener who is to be notified.
	 * @param key 
	 *        The key the result was added to {@link Runner} with. May be null.
	 * @param result A future who's value has finished being calculated.
	 * 
	 * @throws NullPointerException if listener or result are null.
	 * @throws IllegalStateException if {@link Future#isDone()} returns false 
	 * when called on the {@code result}.
	 */
	<K, T> void notify(ResultListener<K, T> listener, K key, Future<T> result);
}
